﻿using System;
using Microsoft.Extensions.Configuration;
using Microsoft.Extensions.DependencyInjection;

namespace FileStorage
{
    public static class FileStorageStartupExtensions
    {
        public static FileStorageAppBuilder AddStorage(this IServiceCollection services,
            Action<FileStorageOptions> configureAction)
        {
            services.Configure(configureAction);
            return AddStorageInternal(services);
        }

        public static FileStorageAppBuilder AddStorage(this IServiceCollection services, IConfiguration configuration)
        {
            services.Configure<FileStorageOptions>(configuration);
            return AddStorageInternal(services);
        }

        private static FileStorageAppBuilder AddStorageInternal(this IServiceCollection services)
        {
            return new FileStorageAppBuilder(services);
        }
    }
}